package com.mydemo.design_pattern.create_type.factory;

import com.mydemo.design_pattern.create_type.factory.impl.Demo1Product;
import com.mydemo.design_pattern.create_type.factory.impl.Demo2Product;
import com.mydemo.design_pattern.create_type.factory.impl.Demo3Product;

/**
 * <p></p >
 *
 * @author liming1
 * @version $Id: ProducterFactory, v1.0 2019-09-18 10:07 liming1 Exp $
 */
public class ProductFactory {

    public static IProduct getProduct(String name) {
        IProduct iProduct = null;
        switch (name) {
            case "demo1":
                iProduct = new Demo1Product();
                break;
            case "demo2":
                iProduct = new Demo2Product();
                break;
            case "demo3":
                iProduct = new Demo3Product();
                break;
        }
        return iProduct;
    }
}
